import { post, get } from '../request'

export const processApi = {
  /**
   * 部署流程xml
   * @param data
   * @returns
   */
  deployByXml(data: { key: string; name: string; xml: string }) {
    return post({
      url: `/flw/flow-def/deploy`,
      data
    })
  },

  /**
   * 查询流程部署Xml
   * @param deploymentId
   * @returns
   */
  findXml(deploymentId: string) {
    return get({ url: `/flw/flow-def/xml/${deploymentId}` })
  },

  /**
   * 查询流程部署Xml
   * @param deploymentId
   * @returns
   */
  findXmlByKey(key: string) {
    return get({ url: `/flw/flow-def/xml/key/${key}` })
  },

  /**
   * 查询所有流程定义列表
   * @returns
   */
  findDefList() {
    return get({ url: `/flw/flow-def/list` })
  },

  /**
   * 查询版本列表
   * @param key
   * @returns
   */
  findVersionList(key: string) {
    return get({ url: `/flw/flow-def/version/${key}` })
  }
}
